package com.asa.ui.I.sort;

public class InsertionSortData {

	private int[] numbers; 
	
	public int orderedIndex = -1;//0...orderedIndex is sorted
	public int currentIndex = -1;//当前最小元素的索引
	// 我们的算法类不允许产生任何实例
    public InsertionSortData(int N,int randomBound){
    	numbers = new int[N];
    	
    	for (int i = 0; i < N; i++) {
			numbers[i] = (int) (Math.random()*randomBound) + 1;
		}
    	
    }
    public int N() {return numbers.length;}
    
    public int get(int index) {
    	if (index<0||index>= numbers.length) {
			
    		throw new IllegalArgumentException("invalid index to access sort data");
		}
    	return numbers[index];
    }
    
    
    
    
    public void swap(int i, int j) {
        int t = numbers[i];
        numbers[i] = numbers[j];
        numbers[j] = t;
    }
    
    
    
    
    
 
}
